package cn.tedu.study.security;

import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * @author:yuziji
 * @create: 2023-06-08 11:43
 * @description:
 */
//因为父类中有构造方法，此时添加@Data会让当前类添加构造方法，此方法可能会和父类的冲突导致报错
@Getter
public class CustomUserDetail extends User {
    private Integer id;
    private String nickname;
    private String avatar;
    private String password;
    private Integer gender;
    private Integer age;
    private Integer isAdmin;
    private String intro;

    public CustomUserDetail(String username, String password, Integer id, String nickname,
                            String avatar, Integer gender, Integer isAdmin, String intro, Integer age,
                            Collection<? extends GrantedAuthority> authorities) {
        super(username, password, authorities);
        this.id = id;
        this.nickname = nickname;
        this.avatar = avatar;
        this.password = password;
        this.gender = gender;
        this.age = age;
        this.isAdmin = isAdmin;
        this.intro = intro;
    }
}
